/**
 * @param {number[]} nums
 * @return {number[]}
 */
var exchange = function (nums) {

  for (let i = 0; i < nums.length; i++) {
    if (nums[i] % 2 == 0) {
      for (let j = nums.length - 1; j > i; j--) {
        if (nums[j] % 2 != 0) {
          let tmp = nums[i]
          nums[i] = nums[j]
          nums[j] = tmp
          break
        }
      }

    }

  }

  return nums

};
console.log(exchange([1, 3, 5, 6, 7, 3, 3, 2, 5, 3, 2, 52]))